package com.example.hello;


import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.agp.components.DependentLayout;
import ohos.agp.components.DirectionalLayout;
import ohos.agp.components.MagicLayout;
import ohos.agp.components.Text;
import ohos.agp.utils.LayoutAlignment;
import ohos.agp.window.service.WindowManager;
import ohos.eventhandler.EventHandler;
import ohos.eventhandler.EventRunner;


public class RespAbility extends Ability {


    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        //隐藏状态栏和导航栏，全屏显示
        getWindow().addFlags(WindowManager.LayoutConfig.MARK_TRANSLUCENT_NAVIGATION);
        super.setUIContent(ResourceTable.Layout_ability_resp);


        EventHandler eventHandler = new EventHandler(EventRunner.getMainEventRunner());
        eventHandler.postTask(new Runnable() {
            @Override
            public void run() {
                setResult(0, new Intent().setParam("resultData", ""+Math.random()));
                terminateAbility();
            }
        }, 2000);
    }

}